

#pragma once

#include "drivers/io_types.h"

#ifdef I_AM_REMOTE_CONTROLLER
typedef enum {
    ADC_CHANNEL0 = 0,
    ADC_CHANNEL1 = 1,
    ADC_CHANNEL2 = 2,
    ADC_CHANNEL3 = 3,
    ADC_BAT = 4,
    ADC_CHANNEL_COUNT
} AdcChannel;
#else
typedef enum {
    ADC_BATTERY = 0,
    ADC_CHANNEL_COUNT
} AdcChannel;
#endif

typedef struct adc_config_s {
    ioTag_t tag;
    uint8_t adcChannel;         // ADC1_INxx channel number
    uint8_t dmaIndex;           // index into DMA buffer in case of sparse channels
    bool enabled;
    uint8_t sampleTime;
} adcOperatingConfig_t;

typedef struct adcChannelConfig_t {
    bool enabled;
    ioTag_t ioTag;
} adcChannelConfig_t;

void adcInit();
uint16_t adcGetChannel(uint8_t channel);
